package com.sunny.l67;

/**
 * @Author zsunny
 * @Date 2018/9/20 9:24
 * @Mail zsunny@yeah.net
 */
public class Solution {
    public ListNode deleteDuplicates(ListNode head) {
        if(null == head || null == head.next)
            return head;
        ListNode prev = head;
        ListNode cur = head.next;
        while (null != cur){
            if(cur.val == prev.val){
                prev.next = cur.next;
            }else{
                prev = cur;
            }
            cur = cur.next;
        }
        return head;
    }
}

class ListNode {
    int val;
    ListNode next;
    ListNode(int x) {
        val = x;
        next = null;
    }
}
